<template>
  <div>
    <div id="1">
      <ul>
        <li v-for="(item, index) in arr" :key="index">{{ item }}</li>
      </ul>
      <button @click="sortBtn">排序</button>
      <button @click="revBtn">翻转</button>
      <button @click="xgBtn">修改第二个元素的值</button>
    </div>
    <hr />
    <hr />
    <hr />
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1, 7, 5, 9, 3, 10, 2],
      list: [
        {
          name: "小明",
          id: 100,
        },
        {
          name: "老王",
          id: 194,
        },
        {
          name: "老秦",
          id: 239,
        },
        {
          name: "老李",
          id: 15,
        },
        {
          name: "老赵",
          id: 27,
        },
      ],
    };
  },
  methods: {
    sortBtn() {
      this.arr.sort((a, b) => {
        return a - b;
      });
    },
    revBtn() {
      this.arr.reverse();
    },
    xgBtn() {
      this.$set(this.arr, 1, 1000);
    },
  },
};
</script>

<style>
</style>